<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-input v-model="query.ownerName" clearable placeholder="姓名" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-date-picker v-model="query.dateBegin" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable placeholder="开始日期" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-date-picker v-model="query.dateEnd" format="yyyy-MM-dd" value-format="yyyy-MM-dd" clearable placeholder="结束日期" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <el-button class="filter-item" size="mini" type="primary" @click="exportExcel">导出Excel</el-button>
  </div>
</template>

<script>
import checkPermission from '@/utils/permission'
import eForm from './form'
export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    permissions: {
      type: Array,
      required: true
    },
    companyLevels: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      downloadLoading: false,
      companyType: ""
    }
  },
  methods: {
    checkPermission,
    toQuery() {
      console.log(this.query)
      this.$parent.page = 0
      this.$parent.init()
    },
    changeType(e) {
      this.query.companyType = e
      // this.toQuery()
    },
    exportExcel() {
      const url = `https://jinfang.xunyu.shop/admin/settleDetail/export?dateBegin=${this.query.dateBegin || ''}&dateEnd=${this.query.dateEnd || ''}&settleStatus=${this.query.settleStatus || ''}&pageNum=${this.$parent.page}&pageSize=${this.$parent.limit}`
      window.open(url)
    },
  }
}
</script>
